﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace project_phoenix.source
{
    // represents an item in the menuscreen
    class MenuEntry
    {
        private string m_text;
        private SpriteFont m_spriteFont;
        private Vector2 m_position;
        private string m_description;
        private Texture2D m_texture;

        // makes a new menu item w/ the text
        public MenuEntry(string text)
        {
            m_text = text;
        }

        // event for when this item is selected
        public event EventHandler<PlayerIndexEventArgs> Selected;

        // function for when the selected event is called
        protected internal virtual void OnSelectEntry(PlayerIndex playerIndex)
        {
            
            if (Selected != null)
                Selected(this, new PlayerIndexEventArgs(playerIndex));
        }


        public virtual void Update(MenuScreen screen, bool isSelected, GameTime gameTime) {}


        // TODO : change this to fit the game, for now just some test drawing
        public virtual void Draw(MenuScreen screen, bool isSelected, GameTime gameTime)
        {
            // if it is selected draw yellow for now otherwise use white
            Color color = isSelected ? Color.Tomato : Color.White;

            // Get our sprite batch
            ScreenManager screenManager = screen.ScreenManager;

            GameSystems.Graphics.DrawText(m_text, m_position, color);
        }




        #region Properties

        public string Text
        {
            get { return m_text; }
            set { m_text = value; }
        }

        public SpriteFont Font
        {
            get { return m_spriteFont; }
            set { m_spriteFont = value; }
        }

        public Vector2 Position
        {
            get { return m_position; }
            set { m_position = value; }
        }

        public string Description
        {
            get { return m_description; }
            set { m_description = value; }
        }

        public Texture2D Texture
        {
            get { return m_texture; }
            set { m_texture = value; }
        }

        #endregion
    }
}
